*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* OUTPUT: FIGURE A1 (ONLINE APPENDIX)

***************************

cd ""

clear *
use "DTA files/Dataset", clear

**************** CHART WITH DISTRIBUTION OF REFORMS *******************

drop if industry != "A"

gen r1 = EPLregularworkers
gen r2 = EPLregularworkers

replace r1 = 0 if r1 < 0
replace r2 = 0 if r2 > 0

replace r2 = -1*r2

sum id_country 
local max = r(max)

mat j=J(`max',1,0)
mat rownames j = Australia Austria Belgium Canada CzechRepublic Denmark Finland France Germany Greece Ireland Italy Japan Korea Luxembourg Netherlands Portugal SlovakRepublic Spain Sweden UnitedKingdom UnitedStates

mat li j
local nospace: subinstr loc nodot " " "", all
local respace: subinstr loc nospace "'`" "' `", all
mat rownames j = `respace'

egen trend = group(year)
foreach x in trend r1 r2 {
replace `x' = . if year == 2014 | year == 2015
}
gen label = string(year)
replace label = "" if year == 2014 | year == 2015
xtset id_country year

forvalues i = 1 / `max' {
local names : rownames j
local this_name = "`:word `i' of `names''"

graph bar r1 r2 if id_country == `i',  bar(1,color(green)) bar(2,color(red)) over(label,  relabel(1 "1970" 2 " " 3 " " 4 " " 5 " " 6 " " 7" " 8" "9" "10" "11"1980"12" "13" "14" "15" "16" "17" "18" "19" "20" "21"1990"22" "23" "24" "25" "26" "27" "28" "29" "30" "31"2000"32" "33" "34" "35" "36" "37" "38" "39" "40" "41"2010"42" "43" "44" "45" " ) sort(trend) label(labsize(small)))  legend(label(1 "Liberalizing reforms") label(2 "Tightening reforms") size(vsmall) rows(2)) ylab(0(1)1,labsize(small)) graphregion(color(white)) title("`this_name'",size(medium))
graph copy g`i', replace
graph close g`i'
}

graph bar r1 r2 if id_country == 5,  bar(1,color(green)) bar(2,color(red)) over(label,  relabel(1 "1990" 2 " " 3 " " 4 " " 5 " " 6 " " 7" " 8" "9" "10" "11"2000"12" "13" "14" "15" "16" "17" "18" "19" "20" "21"2010"22" "23" "24" "25" ") sort(trend) label(labsize(small)))  legend(label(1 "Liberalizing reforms") label(2 "Tightening reforms") size(vsmall) rows(2)) ylab(0(1)1,labsize(small)) graphregion(color(white)) title("CzechRepublic",size(medium))
graph copy g5, replace
graph close g5

graph bar r1 r2 if id_country == 21,  bar(1,color(green)) bar(2,color(red)) over(label,  relabel(1 "1990" 2 " " 3 " " 4 " " 5 " " 6 " " 7" " 8" "9" "10" "11"2000"12" "13" "14" "15" "16" "17" "18" "19" "20" "21"2010"22" "23" "24" "25" ") sort(trend) label(labsize(small)))  legend(label(1 "Liberalizing reforms") label(2 "Tightening reforms") size(vsmall) rows(2)) ylab(0(1)1,labsize(small)) graphregion(color(white)) title("SlovakRepublic",size(medium))
graph copy g21, replace
graph close g21

grc1leg g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11 g12 g13 g14 g15 g16 g17 g18 g19 g20 g21 g22 g23 g24 g25 g26, legendfrom(g1) cols(4) graphregion(color(white)) pos(5) ring(0)
graph export "Figures/A2.png", replace

